package cn.senjoeson.timedowner.dao;

import android.content.Context;
import android.database.Cursor;

import cn.senjoeson.timedowner.bean.HeartDetailBean;

/**
 * @author Android
 * @date 2017/12/28
 */

public class HeartDetailtDao extends BaseDao<HeartDetailBean> {
    /**
     * @param context    上下文
     * @param TABLE_NAME 表名
     */
    public HeartDetailtDao(Context context, String TABLE_NAME) {
        super(context, TABLE_NAME);
    }

    @Override
    protected String createTableExce() {
        return DBConfig.CREATE_TABLE_CONTENT;
    }

    @Override
    public HeartDetailBean getSingleData(Cursor cursor) {
        HeartDetailBean heartDetailBean = new HeartDetailBean();
        long titleid = cursor.getLong(0);
        long contentid = cursor.getLong(1);
        String content = cursor.getString(2);
        heartDetailBean.setTitleid(titleid);
        heartDetailBean.setContentid(contentid);
        heartDetailBean.setContent(content);
        return heartDetailBean;
    }

    @Override
    protected String setUniqueField() {
        return "contentid";
    }
}
